package com.oocl.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.oocl.dao.DeliverInfoDao;
import com.oocl.dao.base.BaseJPADaoUtil;
import com.oocl.entity.DeliverInfo;

@Repository("deliverInfoDao")
public class DeliverInfoDaoImpl extends BaseJPADaoUtil implements DeliverInfoDao{

	/*
	 * @Method: loadAllDeliverInfoByCid
	 * @function: find deliver info list of the client whose id is 'cid'
	 * @param: String cid
	 * @author: wendy
	 * @date 2017-08-12
	 */
	@Override
	public List<DeliverInfo> loadAllDeliverInfoByCid(String cid) {
		// TODO Auto-generated method stub
		
		String jpql="select d from DeliverInfo d left join fetch d.client dc where dc.cid=:cid";
		
		List<DeliverInfo> dlist=new ArrayList<DeliverInfo>();
		dlist=entityManager.createQuery(jpql)
				.setParameter("cid", cid)
				.getResultList();
		return dlist;
	}

	

}
